#include "roundbutton.h"

RoundButton::RoundButton(QWidget *parent)
    : QPushButton(parent) {
    setFixedSize(100, 100); // 设置按钮的固定大小
}

void RoundButton::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing); // 启用抗锯齿

    // 绘制圆形背景
    QBrush brush(Qt::blue);
    painter.setBrush(brush);
    painter.drawEllipse(0, 0, width(), height());

    // 绘制按钮文本
    QPen pen(Qt::white);
    painter.setPen(pen);
    painter.drawText(rect(), Qt::AlignCenter, text());
}
